<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <base href="<%=basePath%>">
    <link rel="stylesheet" href="static/component/pear/css/pear.css" />
    <link rel="stylesheet" href="static/lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="static/css/public.css" media="all">
</head>
<body>

<form class="layui-form" action="">
    <input type="hidden" name="purCode" value="${purCode}">
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">驳回原因</label>
        <div class="layui-input-block">
            <textarea placeholder="请输入驳回原因" class="layui-textarea" name="remarks"></textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">

            <button type="button" class="layui-btn" lay-submit lay-filter="rejectCause">驳回</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
<script src="static/component/layui/layui.js"></script>
<script src="static/component/pear/pear.js"></script>
</body>

<script>

    layui.use(['laydate','form'], function() {
        var laydate = layui.laydate;
        var $ = layui.jquery;
        var form = layui.form;


        //表单提交事件
        form.on("submit(rejectCause)",function (data){

            //执行修改操作
            $.post("purchase/purchaseReject",{role:"经理驳回:"+data.field.remarks,purCode:data.field.purCode} ,function (result){
                if (result.success){
                    layer.msg(result.msg,{icon:1,time:1000},function(){
                        window.close();
                        parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
                        parent.layui.table.reload("purchase");
                    });
                }

            })
        })
    })

</script>
</html>